package com.aistar.service.impl;

import com.aistar.mapper.ReviewsImageMapper;
import com.aistar.pojo.ReviewsImage;
import com.aistar.pojo.ReviewsImageExample;
import com.aistar.service.ReviewsImageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ReviewsImageServiceImpl implements ReviewsImageService {
    @Autowired
    private ReviewsImageMapper reviewsImageMapper;

    @Override
    public List<ReviewsImage> getByReviewId(Integer reviewId) {

        ReviewsImageExample example = new ReviewsImageExample();
        ReviewsImageExample.Criteria criteria = example.createCriteria();
        criteria.andDishReviewIdEqualTo(reviewId);

        List<ReviewsImage> reviewsImageList = reviewsImageMapper.selectByExample(example);
        return  reviewsImageList;
    }

    @Override
    public ReviewsImage getById(Integer id) {
        return reviewsImageMapper.selectByPrimaryKey(id);
    }
}
